import { TokenRequestData, TableResponseData, tradeExtensionDataType } from '@/types/interface'
import {
  BikeLongTermOperationType,
  BikeShortTermOperationType,
  BoxOperationType,
  OrderChangeLogOperationType,
  VoltageType,
  OperationType,
  ShortTermAdjustType,
  ChannelType
} from '@/types/enum'
/**
 * 查询长租车操作记录
 */
export interface queryBikeLongTermOperationRequestData extends TokenRequestData {
  bikeCode: string
  phone: string
  type: BikeLongTermOperationType
}

export interface queryBikeLongTermOperationTableCol {
  bikeOperationId: number
  userId: string
  orderId: string
  type: BikeLongTermOperationType
  bikeId: number
  bikeCode: string
  bikeLockId: string
  batteryId: string
  batteryPowerLevel: string //电池电量
  inputVoltage: string //电池电压(若支持)
  longtitude: string //经度
  latitude: string //纬度
  operationData: string
  createdTime: string
}

export type queryBikeLongTermOperationResponseData =
  TableResponseData<queryBikeLongTermOperationTableCol>

export type queryBikeLongTermOperationResponse =
  ApiResponseData<queryBikeLongTermOperationResponseData>

/**
 * 查询短租车操作记录
 */

export interface queryBikeShortTermOperationRequestData extends TokenRequestData {
  bikeCode: string
  phone: string
  type: BikeShortTermOperationType
  orderId?: string
  role: 'user' | 'employee' | 'customer' | ''
}

export interface queryBikeShortTermOperationTableCol {
  bikeOperationId: number
  phone: string
  type: BikeShortTermOperationType
  bikeId: number
  bikeCode: string
  deviceLongitude: string //车辆经度
  deviceLatitude: string //车辆纬度
  operationData: string
  createdTime: string
  userLatitude: string //操作人纬度
  userLongitude: string //操作人经度
  role: '运维' | '用户' | '客服'
  channel: ChannelType
  version: string
}

export type queryBikeShortTermOperationResponseData =
  TableResponseData<queryBikeShortTermOperationTableCol>

export type queryBikeShortTermOperationResponse =
  ApiResponseData<queryBikeShortTermOperationResponseData>

/**
 * 查询电柜操作记录
 */

export interface queryBoxOperationRequestData extends TokenRequestData {
  boxCode: string
  type: BoxOperationType
  userId?: string
}

export interface queryBoxOperationTableCol {
  boxOperationId: number
  userId: string
  type: BoxOperationType
  boxId: number
  boxCode: string
  boxLockId: string
  doorNumber: number
  doorOpenTime: string
  batteryId: string
  batteryPowerLevel: string
  inputVoltage: VoltageType
  orderId: string
  createdTime: string
  longtitude: string
  latitude: string
}

export type queryBoxOperationResponseData = TableResponseData<queryBoxOperationTableCol>

export type queryBoxOperationResponse = ApiResponseData<queryBoxOperationResponseData>

export interface queryOrderChangeLogRequestData extends TokenRequestData {
  orderId: string
  operationType: OrderChangeLogOperationType | ''
  phone: string
}

export interface queryOrderChangeLogTableCol {
  orderLoggingId: string
  mobilePhone: string //用户手机号
  orderType: string //套餐类型
  orderId: string //订单
  operationType: string //操作类型
  reason: string //调整原因
  operator: string //操作人
  createdTime: string //调整时间
  duration: string // 时长/次数
  giftTime: string
}

export type queryOrderChangeLogResponseData = TableResponseData<queryOrderChangeLogTableCol>

export type queryOrderChangeLogResponse = ApiResponseData<queryOrderChangeLogResponseData>

export interface queryFeeChangeLogRequestData extends TokenRequestData {
  userId: string
  orderId: string
  type: OperationType | ''
  operationType: ShortTermAdjustType | ''
  phone?: string
}

export interface queryFeeChangeLogTabelCol {
  phone: string
  orderId: string
  totalAmount: string
  tradeExtensionData: tradeExtensionDataType
  deductionType: string
  payStatus: string
  waitPayExtensionData: tradeExtensionDataType
  operationType: string
  amount: string
  discountCoupon: string
  reason: string
  changeTime: string
  operator: string
}

export type queryFeeChangeLogResponseData = TableResponseData<queryFeeChangeLogTabelCol>
export type queryFeeChangeLogResponse = ApiResponseData<queryFeeChangeLogResponseData>
